$('.sidebar-elements li.parent').click(function(){
    let i = $('.sidebar-elements li.parent').index(this);
    localStorage.setItem('menu_index',i);
});

let index  =  localStorage.getItem('menu_index');
$('.sidebar-elements li.parent').eq(index).addClass('open')
